﻿Option Infer On

#Region "NameSpaces"
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Data.Linq
Imports System.Data.Linq.Mapping
Imports System.Linq
Imports System.Xml.Linq
Imports System.Linq.Expressions
Imports Microsoft.Practices.EnterpriseLibrary.Data
#End Region
Namespace BusinessLayer
    Public Class SystemConfiguration

#Region "Declarations"

        Private m_strControlForeColor As String
        Private m_GridSelRowBackColor As Integer
        Private m_GridSelRowForeColor As Integer
        Private m_GridNonSelRowBackColor As Integer
        Private m_GridNonSelRowForeColor As Integer
        Private m_GridColHeaderBackColor As Integer
        Private m_GridColHeaderForeColor As Integer
        Private m_GridBackColor As Integer
        Private m_InactiveContactColor As Integer
        Private m_WelcomeNoteForeColor As Integer
        Private m_FormBackColor As Integer
        Private m_PanelBackColor As Integer
        Private m_GrpBoxBackColor As Integer
        Private m_CountryCode As String
        Private m_AreaCode As String
        Private m_InterfaxUserName As String
        Private m_InterfaxPassword As String
        Private m_InterFaxGap As Integer
        'Private m_SQLServer As String
        'Private m_SQLDatabase As String
        'Private m_SQLUserName As String
        'Private m_SQLPassword As String
        Private m_EmailSMTPServer As String
        Private m_EmailFrom As String
        Private m_EmailFromPassword As String
        Private m_IsSMTPRequireSSL As Boolean
        Private m_IsAllowAnonymous As Boolean
        Private m_SendUsing As String
        Private m_SMTPServerPort As Integer
        Private m_EmailPriority As String
        Private m_CPCompany As String
        Private m_CPAddress As String
        Private m_CPCity As String
        Private m_CPPostalCode As String
        Private m_CPPreDD As String
        Private m_CPDD As String
        Private m_CPPreTelephone As String
        Private m_CPTelephone As String
        Private m_CPPreFax As String
        Private m_CPFax1 As String
        Private m_CPFax2 As String
        Private m_CoverLetterFrom As String
        Private m_CoverLetterSubject As String
        Private m_CoverLetterFilePath As String
        Private m_UserID As Integer
#End Region
#Region "Properties"

        Public Property ControlForeColor() As String
            Get
                Return m_strControlForeColor
            End Get
            Set(ByVal value As String)
                m_strControlForeColor = value
            End Set
        End Property

        Public Property GridSelRowBackColor() As Integer
            Get
                GridSelRowBackColor = m_GridSelRowBackColor
            End Get
            Set(ByVal value As Integer)
                m_GridSelRowBackColor = value
            End Set
        End Property
        Public Property GridSelRowForeColor() As Integer
            Get
                GridSelRowForeColor = m_GridSelRowForeColor
            End Get
            Set(ByVal value As Integer)
                m_GridSelRowForeColor = value
            End Set
        End Property
        Public Property GridNonSelRowBackColor() As Integer
            Get
                GridNonSelRowBackColor = m_GridNonSelRowBackColor
            End Get
            Set(ByVal value As Integer)
                m_GridNonSelRowBackColor = value
            End Set
        End Property
        Public Property GridNonSelRowForeColor() As Integer
            Get
                GridNonSelRowForeColor = m_GridNonSelRowForeColor
            End Get
            Set(ByVal value As Integer)
                m_GridNonSelRowForeColor = value
            End Set
        End Property
        Public Property GridColHeaderBackColor() As Integer
            Get
                GridColHeaderBackColor = m_GridColHeaderBackColor
            End Get
            Set(ByVal value As Integer)
                m_GridColHeaderBackColor = value
            End Set
        End Property
        Public Property GridColHeaderForeColor() As Integer
            Get
                GridColHeaderForeColor = m_GridColHeaderForeColor
            End Get
            Set(ByVal value As Integer)
                m_GridColHeaderForeColor = value
            End Set
        End Property
        Public Property GridBackColor() As Integer
            Get
                GridBackColor = m_GridBackColor
            End Get
            Set(ByVal value As Integer)
                m_GridBackColor = value
            End Set
        End Property
        Public Property InactiveContactColor() As Integer
            Get
                InactiveContactColor = m_InactiveContactColor
            End Get
            Set(ByVal value As Integer)
                m_InactiveContactColor = value
            End Set
        End Property
        Public Property WelcomeNoteForeColor() As Integer
            Get
                WelcomeNoteForeColor = m_WelcomeNoteForeColor
            End Get
            Set(ByVal value As Integer)
                m_WelcomeNoteForeColor = value
            End Set
        End Property
        Public Property FormBackColor() As Integer
            Get
                FormBackColor = m_FormBackColor
            End Get
            Set(ByVal value As Integer)
                m_FormBackColor = value
            End Set
        End Property
        Public Property PanelBackColor() As Integer
            Get
                PanelBackColor = m_PanelBackColor
            End Get
            Set(ByVal value As Integer)
                m_PanelBackColor = value
            End Set
        End Property
        Public Property GrpBoxBackColor() As Integer
            Get
                GrpBoxBackColor = m_GrpBoxBackColor
            End Get
            Set(ByVal value As Integer)
                m_GrpBoxBackColor = value
            End Set
        End Property
        Public Property CountryCode() As String
            Get
                CountryCode = m_CountryCode
            End Get
            Set(ByVal value As String)
                m_CountryCode = value
            End Set
        End Property
        Public Property AreaCode() As String
            Get
                AreaCode = m_AreaCode
            End Get
            Set(ByVal value As String)
                m_AreaCode = value
            End Set
        End Property
        Public Property InterfaxUserName() As String
            Get
                InterfaxUserName = m_InterfaxUserName
            End Get
            Set(ByVal value As String)
                m_InterfaxUserName = value
            End Set
        End Property

        Public Property InterfaxPassword() As String
            Get
                InterfaxPassword = m_InterfaxPassword
            End Get
            Set(ByVal value As String)
                m_InterfaxPassword = value
            End Set
        End Property
        Public Property InterFaxGap() As Integer
            Get
                InterFaxGap = m_InterFaxGap
            End Get
            Set(ByVal value As Integer)
                m_InterFaxGap = value
            End Set
        End Property

        'Public Property SQLServer() As String
        '    Get
        '        SQLServer = m_SQLServer
        '    End Get
        '    Set(ByVal value As String)
        '        m_SQLServer = value
        '    End Set
        'End Property
        'Public Property SQLDatabase() As String
        '    Get
        '        SQLDatabase = m_SQLDatabase
        '    End Get
        '    Set(ByVal value As String)
        '        m_SQLDatabase = value
        '    End Set
        'End Property
        'Public Property SQLUserName() As String
        '    Get
        '        SQLUserName = m_SQLUserName
        '    End Get
        '    Set(ByVal value As String)
        '        m_SQLUserName = value
        '    End Set
        'End Property
        'Public Property SQLPassword() As String
        '    Get
        '        SQLPassword = m_SQLPassword
        '    End Get
        '    Set(ByVal value As String)
        '        m_SQLPassword = value
        '    End Set
        'End Property
        Public Property EmailSMTPServer() As String
            Get
                EmailSMTPServer = m_EmailSMTPServer
            End Get
            Set(ByVal value As String)
                m_EmailSMTPServer = value
            End Set
        End Property
        Public Property EmailFrom() As String
            Get
                EmailFrom = m_EmailFrom
            End Get
            Set(ByVal value As String)
                m_EmailFrom = value
            End Set
        End Property
        Public Property EmailFromPassword() As String
            Get
                EmailFromPassword = m_EmailFromPassword
            End Get
            Set(ByVal value As String)
                m_EmailFromPassword = value
            End Set
        End Property
        Public Property IsSMTPRequireSSL() As Boolean
            Get
                IsSMTPRequireSSL = m_IsSMTPRequireSSL
            End Get
            Set(ByVal value As Boolean)
                m_IsSMTPRequireSSL = value
            End Set
        End Property
        Public Property IsAllowAnonymous() As Boolean
            Get
                IsAllowAnonymous = m_IsAllowAnonymous
            End Get
            Set(ByVal value As Boolean)
                m_IsAllowAnonymous = value
            End Set
        End Property
        Public Property SendUsing() As String
            Get
                SendUsing = m_SendUsing
            End Get
            Set(ByVal value As String)
                m_SendUsing = value
            End Set
        End Property
        Public Property SMTPServerPort() As Integer
            Get
                SMTPServerPort = m_SMTPServerPort
            End Get
            Set(ByVal value As Integer)
                m_SMTPServerPort = value
            End Set
        End Property
        Public Property EmailPriority() As String
            Get
                EmailPriority = m_EmailPriority
            End Get
            Set(ByVal value As String)
                m_EmailPriority = value
            End Set
        End Property
        Public Property CPCompany() As String
            Get
                CPCompany = m_CPCompany
            End Get
            Set(ByVal value As String)
                m_CPCompany = value
            End Set
        End Property
        Public Property CPAddress() As String
            Get
                CPAddress = m_CPAddress
            End Get
            Set(ByVal value As String)
                m_CPAddress = value
            End Set
        End Property
        Public Property CPCity() As String
            Get
                CPCity = m_CPCity
            End Get
            Set(ByVal value As String)
                m_CPCity = value
            End Set
        End Property
        Public Property CPPostalCode() As String
            Get
                CPPostalCode = m_CPPostalCode
            End Get
            Set(ByVal value As String)
                m_CPPostalCode = value
            End Set
        End Property
        Public Property CPPreDD() As String
            Get
                CPPreDD = m_CPPreDD
            End Get
            Set(ByVal value As String)
                m_CPPreDD = value
            End Set
        End Property
        Public Property CPDD() As String
            Get
                CPDD = m_CPDD
            End Get
            Set(ByVal value As String)
                m_CPDD = value
            End Set
        End Property
        Public Property CPPreTelephone() As String
            Get
                CPPreTelephone = m_CPPreTelephone
            End Get
            Set(ByVal value As String)
                m_CPPreTelephone = value
            End Set
        End Property
        Public Property CPTelephone() As String
            Get
                CPTelephone = m_CPTelephone
            End Get
            Set(ByVal value As String)
                m_CPTelephone = value
            End Set
        End Property
        Public Property CPPreFax() As String
            Get
                CPPreFax = m_CPPreFax
            End Get
            Set(ByVal value As String)
                m_CPPreFax = value
            End Set
        End Property
        Public Property CPFax1() As String
            Get
                CPFax1 = m_CPFax1
            End Get
            Set(ByVal value As String)
                m_CPFax1 = value
            End Set
        End Property
        Public Property CPFax2() As String
            Get
                CPFax2 = m_CPFax2
            End Get
            Set(ByVal value As String)
                m_CPFax2 = value
            End Set
        End Property
        Public Property CoverLetterFrom() As String
            Get
                CoverLetterFrom = m_CoverLetterFrom
            End Get
            Set(ByVal value As String)
                m_CoverLetterFrom = value
            End Set
        End Property
        Public Property CoverLetterSubject() As String
            Get
                CoverLetterSubject = m_CoverLetterSubject
            End Get
            Set(ByVal value As String)
                m_CoverLetterSubject = value
            End Set
        End Property
        Public Property CoverLetterFilePath() As String
            Get
                CoverLetterFilePath = m_CoverLetterFilePath
            End Get
            Set(ByVal value As String)
                m_CoverLetterFilePath = value
            End Set
        End Property
        Public Property UserID() As Integer
            Get
                UserID = m_UserID
            End Get
            Set(ByVal value As Integer)
                m_UserID = value
            End Set
        End Property
#End Region
#Region "Methods"
        Public Function GetConfigValues() As SystemConfiguration
            Dim objBase As BaseClassDataContext
            If BLLmdlCommon.strConfiguration Is Nothing Then
                objBase = New BaseClassDataContext()
            Else
                objBase = New BaseClassDataContext(BLLmdlCommon.strConfiguration)
            End If

            'Dim objConfig As New SystemConfiguration
            '  Try
            objBase.CommandTimeout = 0
            Dim query = (From cn In objBase.CP_CON_SystemConfigurations _
                        Select New SystemConfiguration With { _
                        .ControlForeColor = cn.ControlForeColor, _
                        .m_GridSelRowBackColor = cn.GridSelRowBackColor, _
            .m_GridSelRowForeColor = cn.GridSelRowForeColor, _
            .m_GridNonSelRowBackColor = cn.GridNonSelRowBackColor, _
            .m_GridNonSelRowForeColor = cn.GridNonSelRowForeColor, _
            .m_GridColHeaderBackColor = cn.GridColHeaderBackColor, _
            .m_GridColHeaderForeColor = cn.GridColHeaderForeColor, _
            .m_GridBackColor = cn.GridBackColor, _
            .m_InactiveContactColor = cn.InactiveContactColor, _
            .m_WelcomeNoteForeColor = cn.WelcomeNoteForeColor, _
            .m_FormBackColor = cn.FormBackColor, _
            .m_PanelBackColor = cn.PanelBackColor, _
            .m_GrpBoxBackColor = cn.GrpBoxBackColor, _
            .m_CountryCode = cn.CountryCode, _
            .m_AreaCode = cn.AreaCode, _
            .m_InterfaxUserName = cn.InterfaxUserName, _
            .m_InterfaxPassword = cn.InterfaxPassword, _
            .m_InterFaxGap = cn.InterFaxGap, _
            .m_EmailSMTPServer = cn.EmailSMTPServer, _
            .m_EmailFrom = cn.EmailFrom, _
            .m_EmailFromPassword = cn.EmailFromPassword, _
            .m_IsSMTPRequireSSL = cn.IsSMTPRequireSSL, _
            .m_IsAllowAnonymous = cn.IsAllowAnonymous, _
            .m_SendUsing = cn.SendUsing, _
            .m_SMTPServerPort = cn.SMTPServerPort, _
            .m_EmailPriority = cn.EmailPriority, _
            .m_CPCompany = cn.CPCompany, _
            .m_CPAddress = cn.CPAddress, _
            .m_CPCity = cn.CPCity, _
            .m_CPPostalCode = cn.CPPostalCode, _
            .m_CPPreDD = cn.CPPreDD, _
            .m_CPDD = cn.CPDD, _
            .m_CPPreTelephone = cn.CPPreTelephone, _
            .m_CPTelephone = cn.CPTelephone, _
            .m_CPPreFax = cn.CPPreFax, _
            .m_CPFax1 = cn.CPFax1, _
            .m_CPFax2 = cn.CPFax2, _
            .m_CoverLetterFrom = cn.CoverLetterFrom, _
            .m_CoverLetterSubject = cn.CoverLetterSubject, _
            .m_CoverLetterFilePath = cn.CoverLetterFilePath}).SingleOrDefault()
            If Not query Is Nothing Then
                Return query
            Else
                Return Nothing
            End If
            'Catch ex As Exception
            '    Throw ex
            'Finally
            '    objBase = Nothing
            '    ' objConfig = Nothing
            'End Try
        End Function
        ''' <summary>
        ''' Returns the Full table structure
        ''' </summary>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Private Shared Function GetConfigurationTable() As  _
            System.Data.Linq.Table(Of CP_CON_UserColorConfiguration)
            Dim oBase As New BaseClassDataContext(BLLmdlCommon.strConfiguration)
            Return oBase.GetTable(Of CP_CON_UserColorConfiguration)()
        End Function
       
        Public Function SaveConfigValues()
            Dim objBase As New BaseClassDataContext(BLLmdlCommon.strConfiguration)
            Dim query = (From c In objBase.CP_CON_SystemConfigurations _
            Select c).SingleOrDefault()
            'If query Is Nothing Then
            '    'With query
            '    Dim CL As Table(Of CP_CON_SystemConfiguration) = SystemConfiguration.GetConfigurationTable()

            '    Dim prim As New CP_CON_SystemConfiguration With { _
            '    .GridSelRowBackColor = val.ToArgb()}

            '    CL.InsertOnSubmit(prim)
            '    CL.Context.SubmitChanges()
            '    'End With
            'End If
            With query
                .ControlForeColor = ControlForeColor
                .GridSelRowBackColor = m_GridSelRowBackColor
                .GridSelRowForeColor = m_GridSelRowForeColor
                .GridNonSelRowBackColor = m_GridNonSelRowBackColor
                .GridNonSelRowForeColor = m_GridNonSelRowForeColor
                .GridColHeaderBackColor = m_GridColHeaderBackColor
                .GridColHeaderForeColor = m_GridColHeaderForeColor
                .GridBackColor = m_GridBackColor
                .InactiveContactColor = m_InactiveContactColor
                .WelcomeNoteForeColor = m_WelcomeNoteForeColor
                .FormBackColor = m_FormBackColor
                .PanelBackColor = m_PanelBackColor
                .GrpBoxBackColor = m_GrpBoxBackColor
                .CountryCode = m_CountryCode
                .AreaCode = m_AreaCode
                .InterfaxUserName = m_InterfaxUserName
                .InterfaxPassword = m_InterfaxPassword
                .InterFaxGap = m_InterFaxGap
                '.SQLServer = m_SQLServer
                '.SQLDatabase = m_SQLDatabase
                '.SQLUserName = m_SQLUserName
                '.SQLPassword = m_SQLPassword
                .EmailSMTPServer = m_EmailSMTPServer
                .EmailFrom = m_EmailFrom
                .EmailFromPassword = m_EmailFromPassword
                .IsSMTPRequireSSL = m_IsSMTPRequireSSL
                .IsAllowAnonymous = m_IsAllowAnonymous
                .SendUsing = m_SendUsing
                .SMTPServerPort = m_SMTPServerPort
                .EmailPriority = m_EmailPriority
                .CPCompany = m_CPCompany
                .CPAddress = m_CPAddress
                .CPCity = m_CPCity
                .CPPostalCode = m_CPPostalCode
                .CPPreDD = m_CPPreDD
                .CPDD = m_CPDD
                .CPPreTelephone = m_CPPreTelephone
                .CPTelephone = m_CPTelephone
                .CPPreFax = m_CPPreFax
                .CPFax1 = m_CPFax1
                .CPFax2 = m_CPFax2
                .CoverLetterFrom = m_CoverLetterFrom
                .CoverLetterSubject = m_CoverLetterSubject
                .CoverLetterFilePath = m_CoverLetterFilePath

                .ModifiedBy = m_UserID
                .ModifiedDate = Today
            End With
            objBase.SubmitChanges()
            Return True

        End Function

        Public Function GetUserColorValues() As SystemConfiguration
            Dim objBase As BaseClassDataContext
            ' Try
            'If BLLmdlCommon.strConfiguration Is Nothing Then
            '    objBase = New BaseClassDataContext()
            'Else
            objBase = New BaseClassDataContext(BLLmdlCommon.strConfiguration)
            'End If
            Dim iCnt As Integer
            iCnt = (From c In objBase.CP_CON_UserColorConfigurations _
                  Where c.UserID = m_UserID Select c).Count
            If iCnt > 0 Then
                Dim query = (From cn In objBase.CP_CON_UserColorConfigurations _
                                Where cn.UserID = m_UserID _
                               Select New SystemConfiguration With { _
                            .m_GridSelRowBackColor = cn.GridSelRowBackColor, _
                .m_GridSelRowForeColor = cn.GridSelRowForeColor, _
                .m_GridNonSelRowBackColor = cn.GridNonSelRowBackColor, _
                .m_GridNonSelRowForeColor = cn.GridNonSelRowForeColor, _
                .m_GridColHeaderBackColor = cn.GridColHeaderBackColor, _
                .m_GridColHeaderForeColor = cn.GridColHeaderForeColor, _
                .m_GridBackColor = cn.GridBackColor, _
                .m_InactiveContactColor = cn.InactiveContactColor, _
                .m_WelcomeNoteForeColor = cn.WelcomeNoteForeColor, _
                .m_FormBackColor = cn.FormBackColor, _
                .m_PanelBackColor = cn.PanelBackColor, _
                .m_GrpBoxBackColor = cn.GrpBoxBackColor, _
                .ControlForeColor = cn.ControlForeColor}).SingleOrDefault()

                If Not query Is Nothing Then
                    Return query
                Else
                    Return Nothing
                End If
            Else
                Return GetAdminColorValues()
            End If
            'Catch ex As Exception
            '    Throw ex
            'Finally
            '    objBase = Nothing
            '    ' objConfig = Nothing
            'End Try
        End Function
        Public Function GetAdminColorValues() As SystemConfiguration
            Dim objBase As BaseClassDataContext
            If BLLmdlCommon.strConfiguration Is Nothing Then
                objBase = New BaseClassDataContext()
            Else
                objBase = New BaseClassDataContext(BLLmdlCommon.strConfiguration)
            End If

            ' Try

            Dim query = (From cn In objBase.CP_CON_SystemConfigurations _
                           Select New SystemConfiguration With { _
                        .m_GridSelRowBackColor = cn.GridSelRowBackColor, _
            .m_GridSelRowForeColor = cn.GridSelRowForeColor, _
            .m_GridNonSelRowBackColor = cn.GridNonSelRowBackColor, _
            .m_GridNonSelRowForeColor = cn.GridNonSelRowForeColor, _
            .m_GridColHeaderBackColor = cn.GridColHeaderBackColor, _
            .m_GridColHeaderForeColor = cn.GridColHeaderForeColor, _
            .m_GridBackColor = cn.GridBackColor, _
            .m_InactiveContactColor = cn.InactiveContactColor, _
            .m_WelcomeNoteForeColor = cn.WelcomeNoteForeColor, _
            .m_FormBackColor = cn.FormBackColor, _
            .m_PanelBackColor = cn.PanelBackColor, _
            .m_GrpBoxBackColor = cn.GrpBoxBackColor}).SingleOrDefault()
            '.m_CountryCode = cn.CountryCode, _
            '.m_AreaCode = cn.AreaCode, _
            '.m_InterfaxUserName = cn.InterfaxUserName, _
            '.m_InterfaxPassword = cn.InterfaxPassword, _
            '.m_InterFaxGap = cn.InterFaxGap, _
            '.m_SQLServer = cn.SQLServer, _
            '.m_SQLDatabase = cn.SQLDatabase, _
            '.m_SQLUserName = cn.SQLUserName, _
            '.m_SQLPassword = cn.SQLPassword, _
            '.m_EmailSMTPServer = cn.EmailSMTPServer, _
            '.m_EmailFrom = cn.EmailFrom, _
            '.m_EmailFromPassword = cn.EmailFromPassword, _
            '.m_IsSMTPRequireSSL = cn.IsSMTPRequireSSL, _
            '.m_IsAllowAnonymous = cn.IsAllowAnonymous, _
            '.m_SendUsing = cn.SendUsing, _
            '.m_SMTPServerPort = cn.SMTPServerPort, _
            '.m_EmailPriority = cn.EmailPriority, _
            '.m_CPCompany = cn.CPCompany, _
            '.m_CPAddress = cn.CPAddress, _
            '.m_CPCity = cn.CPCity, _
            '.m_CPPostalCode = cn.CPPostalCode, _
            '.m_CPPreDD = cn.CPPreDD, _
            '.m_CPDD = cn.CPDD, _
            '.m_CPPreTelephone = cn.CPPreTelephone, _
            '.m_CPTelephone = cn.CPTelephone, _
            '.m_CPPreFax = cn.CPPreFax, _
            '.m_CPFax1 = cn.CPFax1, _
            '.m_CPFax2 = cn.CPFax2, _
            '.m_CoverLetterFrom = cn.CoverLetterFrom, _
            '.m_CoverLetterSubject = cn.CoverLetterSubject, _
            '.m_CoverLetterFilePath = cn.CoverLetterFilePath}).SingleOrDefault()
            If Not query Is Nothing Then
                Return query
            Else
                Return Nothing
            End If
            'Catch ex As Exception
            '    Throw ex
            'Finally
            '    objBase = Nothing
            '    ' objConfig = Nothing
            'End Try
        End Function
        Public Function SaveUserColorValues() As Boolean
            ' Try


            'Dim objBase As New BaseClassDataContext(BLLmdlCommon.strConfiguration)
            'Dim query = (From c In objBase.CP_CON_UserColorConfigurations _
            '          Where c.UserID = m_UserID Select c).SingleOrDefault()
            'If query Is Nothing Then
            '    Dim CL As Table(Of CP_CON_UserColorConfiguration) = SystemConfiguration.GetConfigurationTable()

            '    Dim addColor As New CP_CON_UserColorConfiguration With { _
            '    .GridSelRowBackColor = m_GridSelRowBackColor, _
            '    .GridSelRowForeColor = m_GridSelRowForeColor, _
            '    .GridNonSelRowBackColor = m_GridNonSelRowBackColor, _
            '    .GridNonSelRowForeColor = m_GridNonSelRowForeColor, _
            '    .GridColHeaderBackColor = m_GridColHeaderBackColor, _
            '    .GridColHeaderForeColor = m_GridColHeaderForeColor, _
            '    .GridBackColor = m_GridBackColor, _
            '    .InactiveContactColor = m_InactiveContactColor, _
            '    .WelcomeNoteForeColor = m_WelcomeNoteForeColor, _
            '    .FormBackColor = m_FormBackColor, _
            '    .PanelBackColor = m_PanelBackColor, _
            '    .GrpBoxBackColor = m_GrpBoxBackColor, _
            '    .UserID = m_UserID, _
            '    .CreatedDate = Today}

            '    CL.InsertOnSubmit(addColor)
            '    CL.Context.SubmitChanges()
            'End If
            'With query
            '    .GridSelRowBackColor = m_GridSelRowBackColor
            '    .GridSelRowForeColor = m_GridSelRowForeColor
            '    .GridNonSelRowBackColor = m_GridNonSelRowBackColor
            '    .GridNonSelRowForeColor = m_GridNonSelRowForeColor
            '    .GridColHeaderBackColor = m_GridColHeaderBackColor
            '    .GridColHeaderForeColor = m_GridColHeaderForeColor
            '    .GridBackColor = m_GridBackColor
            '    .InactiveContactColor = m_InactiveContactColor
            '    .WelcomeNoteForeColor = m_WelcomeNoteForeColor
            '    .FormBackColor = m_FormBackColor
            '    .PanelBackColor = m_PanelBackColor
            '    .GrpBoxBackColor = m_GrpBoxBackColor
            '    .UserID = m_UserID
            '    .ModifiedDate = Today
            'End With
            'objBase.SubmitChanges()
            Dim i As Integer
            i = CreateDataBase.ExecuteNonQuery("CP_sp_InsertUpdateColorConfiguration", New Object() {m_GridSelRowBackColor, m_GridSelRowForeColor, _
                m_GridNonSelRowBackColor, m_GridNonSelRowForeColor, m_GridColHeaderBackColor, m_GridColHeaderForeColor, m_GridBackColor, _
                m_InactiveContactColor, m_WelcomeNoteForeColor, m_FormBackColor, m_PanelBackColor, m_GrpBoxBackColor, m_UserID, ControlForeColor})
            If i > 0 Then
                Return True
            Else
                Return False
            End If


            'Catch ex As Exception
            '    Return False
            '    Throw ex
            'End Try
        End Function
#End Region


    End Class
End Namespace
